package transforms 
{
	/**
	 * ...
	 * @author @@AUTHOR@@
	 */
	public class LeetTransform 
	{
		
		public function LeetTransform() 
		{
			
		}
		
		private function replace(data:String, pattern:*, replacement:String):String
		{
		    var s:String = data;
		    var t:String;
		    while(s != (t = s.replace(pattern, replacement)))
		      s = t;
		    return s;
		}
		
		public function run(data:String):String
		{
			var r:String = data;
			
			r = replace(r, /e|E/, "3");
			r = replace(r, /a|A/, "4");
			r = replace(r, /o|O/, "0");
			r = replace(r, /l|L/, "1");
			r = replace(r, /t|T/, "7");
			r = replace(r, "h4ck3r", "haxor");
			
			return r;
		}
		
	}

}
